
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>第零章：实验环境说明 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../chapter1/introduction.html" />
    
    
    <link rel="prev" href="../" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="introduction.html">
            
                <a href="introduction.html">
            
                    
                    第零章：实验环境说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../chapter1/introduction.html">
            
                <a href="../chapter1/introduction.html">
            
                    
                    第一章：独立式可执行程序
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../chapter1/part1.html">
            
                <a href="../chapter1/part1.html">
            
                    
                    [安装 nightly rust]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../chapter1/part2.html">
            
                <a href="../chapter1/part2.html">
            
                    
                    使用包管理器 cargo 创建 rust binary 项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../chapter1/part3.html">
            
                <a href="../chapter1/part3.html">
            
                    
                    移除标准库依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../chapter1/part4.html">
            
                <a href="../chapter1/part4.html">
            
                    
                    [移除 runtime 依赖]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../chapter1/part5.html">
            
                <a href="../chapter1/part5.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../chapter2/introduction.html">
            
                <a href="../chapter2/introduction.html">
            
                    
                    第二章：最小化内核
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter2/part1.html">
            
                <a href="../chapter2/part1.html">
            
                    
                    使用目标三元组描述目标平台
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter2/part2.html">
            
                <a href="../chapter2/part2.html">
            
                    
                    编译、生成内核镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../chapter2/part3.html">
            
                <a href="../chapter2/part3.html">
            
                    
                    使用链接脚本指定内存布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../chapter2/part4.html">
            
                <a href="../chapter2/part4.html">
            
                    
                    [重写程序入口点 -start]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../chapter2/part5.html">
            
                <a href="../chapter2/part5.html">
            
                    
                    [使用 Qemu 运行内核]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../chapter2/part6.html">
            
                <a href="../chapter2/part6.html">
            
                    
                    封装 SBI 接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../chapter2/part7.html">
            
                <a href="../chapter2/part7.html">
            
                    
                    [实现格式化输出]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../chapter2/part8.html">
            
                <a href="../chapter2/part8.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../chapter3/introduction.html">
            
                <a href="../chapter3/introduction.html">
            
                    
                    第三章：中断
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../chapter3/part1.html">
            
                <a href="../chapter3/part1.html">
            
                    
                    rv64 中断介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../chapter3/part2.html">
            
                <a href="../chapter3/part2.html">
            
                    
                    [手动触发断点中断]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../chapter3/part3.html">
            
                <a href="../chapter3/part3.html">
            
                    
                    程序运行上下文环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../chapter3/part4.html">
            
                <a href="../chapter3/part4.html">
            
                    
                    [实现上下文环境保存与恢复]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../chapter3/part5.html">
            
                <a href="../chapter3/part5.html">
            
                    
                    [时钟中断]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../chapter3/part6.html">
            
                <a href="../chapter3/part6.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../chapter4/introduction.html">
            
                <a href="../chapter4/introduction.html">
            
                    
                    第四章：内存管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../chapter4/part1.html">
            
                <a href="../chapter4/part1.html">
            
                    
                    [物理内存探测与管理]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../chapter4/part2.html">
            
                <a href="../chapter4/part2.html">
            
                    
                    [动态内存分配]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../chapter4/part3.html">
            
                <a href="../chapter4/part3.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../chapter5/introduction.html">
            
                <a href="../chapter5/introduction.html">
            
                    
                    第五章：内存虚拟化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../chapter5/part1.html">
            
                <a href="../chapter5/part1.html">
            
                    
                    页表：从虚拟内存到物理内存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../chapter5/part2.html">
            
                <a href="../chapter5/part2.html">
            
                    
                    [内核初始映射]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../chapter5/part3.html">
            
                <a href="../chapter5/part3.html">
            
                    
                    内核重映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../chapter5/part4.html">
            
                <a href="../chapter5/part4.html">
            
                    
                    内核重映射实现之一：页表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../chapter5/part5.html">
            
                <a href="../chapter5/part5.html">
            
                    
                    内核重映射实现之二：MemorySet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../chapter5/part6.html">
            
                <a href="../chapter5/part6.html">
            
                    
                    [内核重映射实现之三：完结]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../chapter5/part7.html">
            
                <a href="../chapter5/part7.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../chapter6/introduction.html">
            
                <a href="../chapter6/introduction.html">
            
                    
                    第六章：内核线程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../chapter6/part1.html">
            
                <a href="../chapter6/part1.html">
            
                    
                    线程状态与保存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../chapter6/part2.html">
            
                <a href="../chapter6/part2.html">
            
                    
                    线程切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../chapter6/part3.html">
            
                <a href="../chapter6/part3.html">
            
                    
                    内核线程初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../chapter6/part4.html">
            
                <a href="../chapter6/part4.html">
            
                    
                    [内核线程创建与切换测试]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../chapter6/part5.html">
            
                <a href="../chapter6/part5.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../chapter7/introduction.html">
            
                <a href="../chapter7/introduction.html">
            
                    
                    第七章：线程调度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../chapter7/part1.html">
            
                <a href="../chapter7/part1.html">
            
                    
                    线程池与线程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../chapter7/part2.html">
            
                <a href="../chapter7/part2.html">
            
                    
                    内核调度线程 idle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../chapter7/part3.html">
            
                <a href="../chapter7/part3.html">
            
                    
                    线程调度之 Round Robin 算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../chapter7/part4.html">
            
                <a href="../chapter7/part4.html">
            
                    
                    [线程调度测试]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../chapter7/part5.html">
            
                <a href="../chapter7/part5.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../chapter8/introduction.html">
            
                <a href="../chapter8/introduction.html">
            
                    
                    第八章：进程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../chapter8/part1.html">
            
                <a href="../chapter8/part1.html">
            
                    
                    [编写用户程序]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../chapter8/part1_1.html">
            
                <a href="../chapter8/part1_1.html">
            
                    
                    合并内核与应用程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../chapter8/part2.html">
            
                <a href="../chapter8/part2.html">
            
                    
                    在内核中实现系统调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../chapter8/part3.html">
            
                <a href="../chapter8/part3.html">
            
                    
                    创建虚拟内存空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../chapter8/part4.html">
            
                <a href="../chapter8/part4.html">
            
                    
                    [创建进程]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../chapter8/part5.html">
            
                <a href="../chapter8/part5.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../chapter9/introduction.html">
            
                <a href="../chapter9/introduction.html">
            
                    
                    第九章：文件系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../chapter9/part1.html">
            
                <a href="../chapter9/part1.html">
            
                    
                    [使用文件系统]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../chapter9/part2.html">
            
                <a href="../chapter9/part2.html">
            
                    
                    [实现记事本]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../chapter9/part3.html">
            
                <a href="../chapter9/part3.html">
            
                    
                    [实现终端]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../chapter9/part4.html">
            
                <a href="../chapter9/part4.html">
            
                    
                    [文件读写]
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../chapter9/part5.html">
            
                <a href="../chapter9/part5.html">
            
                    
                    总结与展望
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../chapter10/introduction.html">
            
                <a href="../chapter10/introduction.html">
            
                    
                    第十章：同步互斥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../exercise/introduction.html">
            
                <a href="../exercise/introduction.html">
            
                    
                    练习题
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../exercise/part1.html">
            
                <a href="../exercise/part1.html">
            
                    
                    1. 中断异常
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../exercise/part2.html">
            
                <a href="../exercise/part2.html">
            
                    
                    2. 物理内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../exercise/part3.html">
            
                <a href="../exercise/part3.html">
            
                    
                    3. 虚拟内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../exercise/part4.html">
            
                <a href="../exercise/part4.html">
            
                    
                    4. 线程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../exercise/part5.html">
            
                <a href="../exercise/part5.html">
            
                    
                    5. 用户进程（+ 虚拟内存管理 + 线程管理）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../exercise/part6.html">
            
                <a href="../exercise/part6.html">
            
                    
                    6. CPU 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.7" data-path="../exercise/part7.html">
            
                <a href="../exercise/part7.html">
            
                    
                    7. 同步互斥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.8" data-path="../exercise/part8.html">
            
                <a href="../exercise/part8.html">
            
                    
                    8. 文件系统
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../appendix/introduction.html">
            
                <a href="../appendix/introduction.html">
            
                    
                    附录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../appendix/inline_asm.html">
            
                <a href="../appendix/inline_asm.html">
            
                    
                    内联汇编
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../appendix/install_rust.html">
            
                <a href="../appendix/install_rust.html">
            
                    
                    安装 rust
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >第零章：实验环境说明</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x7B2C;&#x96F6;&#x7AE0;&#xFF1A;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x8BF4;&#x660E;">&#x7B2C;&#x96F6;&#x7AE0;&#xFF1A;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x8BF4;&#x660E;</h1>
<h2 id="&#x672C;&#x7AE0;&#x6982;&#x8981;">&#x672C;&#x7AE0;&#x6982;&#x8981;</h2>
<p>&#x8FD9;&#x4E00;&#x7AE0;&#x4E3B;&#x8981;&#x5305;&#x62EC;&#xFF1A;</p>
<ul>
<li>&#x5728;&#x7EBF;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x7684;&#x4F7F;&#x7528;&#x8BF4;&#x660E;</li>
<li>docker &#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x7684;&#x4F7F;&#x7528;&#x8BF4;&#x660E;</li>
<li>&#x672C;&#x5730;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x7684;&#x4F7F;&#x7528;&#x8BF4;&#x660E;</li>
</ul>
<p>&#x4E0B;&#x9762;&#x7684;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x5EFA;&#x7ACB;&#x65B9;&#x5F0F;&#x7531;&#x7B80;&#x5355;&#x5230;&#x76F8;&#x5BF9;&#x590D;&#x6742;&#x4E00;&#x4E9B;&#xFF0C;&#x540C;&#x5B66;&#x4EEC;&#x53EF;&#x4EE5;&#x57FA;&#x4E8E;&#x81EA;&#x5DF1;&#x7684;&#x60C5;&#x51B5;&#x9009;&#x62E9;&#x5408;&#x9002;&#x7684;&#x5B9E;&#x9A8C;&#x65B9;&#x5F0F;&#x3002;</p>
<h2 id="&#x5728;&#x7EBF;&#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;">&#x5728;&#x7EBF;&#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;</h2>
<p>&#x76EE;&#x524D;&#x5728;&#x7EBF;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x662F;<a href="https://www.shiyanlou.com/courses/1481" target="_blank">&#x57FA;&#x4E8E;&#x5B9E;&#x9A8C;&#x697C;&#x7684;&#x5728;&#x7EBF;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;</a>&#x3002;&#x7528;&#x6237;&#x53EA;&#x9700;&#x6709;&#x4E00;&#x4E2A;&#x80FD;&#x591F;&#x4E0A;&#x7F51;&#x7684; browser &#x5373;&#x53EF;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;&#x3002;&#x9996;&#x5148;&#x9700;&#x8981;&#x5728;<a href="https://www.shiyanlou.com/" target="_blank">&#x5B9E;&#x9A8C;&#x697C;</a>&#x4E0A;&#x6CE8;&#x518C;&#x4E00;&#x4E2A;&#x8D26;&#x53F7;&#xFF0C;&#x7136;&#x540E;&#x5728;<a href="https://www.shiyanlou.com/courses/1481" target="_blank">rcore &#x5728;&#x7EBF;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;</a>&#x7684;&#x7F51;&#x9875;&#x4E0A;&#x8F93;&#x5165;&#x9A8C;&#x8BC1;&#x7801;&#xFF1A;wfkblCQp &#x5C31;&#x53EF;&#x4EE5;&#x8FDB;&#x5165;&#x5728;&#x7EBF;&#x7684;&#x5B9E;&#x9A8C;&#x73AF;&#x5883;&#x3002;&#x5C1D;&#x8BD5;&#x6267;&#x884C;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#x5C31;&#x5F00;&#x59CB;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;&#x4E86;&#x3002;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x7F16;&#x8BD1;</span>
<span class="token builtin class-name">cd</span> rCore_tutorial<span class="token punctuation">;</span>  <span class="token function">git</span> checkout master<span class="token punctuation">;</span> <span class="token function">make</span> all
<span class="token comment"># &#x8FD0;&#x884C;</span>
<span class="token function">make</span> run
</code></pre>
<h2 id="docker-&#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;">docker &#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;</h2>
<p>&#x6211;&#x4EEC;&#x652F;&#x6301; docker &#x73AF;&#x5883;&#x4E0B;&#x8FDB;&#x884C;&#x5B9E;&#x73B0;&#xFF0C;&#x5728; docker hub &#x4E0A;&#x5DF2;&#x6709;&#x53EF;&#x7528;&#x7684; docker &#x73AF;&#x5883;&#xFF0C;&#x5728;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#x8FD0;&#x884C; <code>make docker</code> &#x5C06;&#x4F1A;&#x4ECE;&#x4E91;&#x7AEF;&#x62C9;&#x53D6; docker &#x955C;&#x50CF;&#xFF0C;&#x5E76;&#x5C06;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x6302;&#x8F7D;&#x5230; <code>/mnt</code> &#x4F4D;&#x7F6E;&#x3002;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x542F;&#x52A8;docker&#x73AF;&#x5883;</span>
<span class="token function">make</span> docker <span class="token comment"># &#x4F1A;&#x8FDB;&#x5165;docker&#x4E2D;&#x7684;&#x7EC8;&#x7AEF;</span>
<span class="token builtin class-name">cd</span> /mnt
<span class="token comment"># &#x7136;&#x540E;&#x53EF;&#x4EE5;&#x8FDB;&#x884C;&#x7F16;&#x8BD1;/qemu&#x4E2D;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;&#x3002;&#x4F8B;&#x5982;&#xFF1A;</span>
<span class="token comment"># &#x7F16;&#x8BD1;&#x7528;&#x6237;&#x6001;app&#x7EC4;&#x6210;&#x7684;image</span>
<span class="token builtin class-name">cd</span> usr
<span class="token function">make</span> user_img
<span class="token comment"># &#x7F16;&#x8BD1;&#x5185;&#x6838;</span>
<span class="token builtin class-name">cd</span> <span class="token punctuation">..</span>/os
<span class="token function">make</span> build
<span class="token comment"># &#x8FD0;&#x884C;</span>
<span class="token function">make</span> run
</code></pre>
<p>&#x5982;&#x6709;&#x5174;&#x8DA3;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x884C;&#x6784;&#x5EFA;/&#x8C03;&#x6574; docker &#x955C;&#x50CF;&#xFF0C;&#x76F8;&#x5173;&#x7684; Dockerfile &#x6587;&#x4EF6;&#x5728;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86; <code>make docker_build</code> &#x547D;&#x4EE4;&#x6765;&#x5E2E;&#x52A9;&#x6784;&#x5EFA;&#xFF0C;&#x8BE6;&#x60C5;&#x8BF7;&#x770B; Dockerfile &#x548C; Makefile</p>
<h2 id="&#x672C;&#x5730;-linux-&#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;">&#x672C;&#x5730; Linux &#x73AF;&#x5883;&#x4E0B;&#x8FD0;&#x884C;&#x5B9E;&#x9A8C;</h2>
<p>&#x6211;&#x4EEC;&#x4E5F;&#x652F;&#x6301;&#x672C;&#x5730; Linux &#x73AF;&#x5883;&#x4E0B;&#x5F00;&#x5C55;&#x5B9E;&#x9A8C;&#xFF0C;&#x4E0D;&#x8FC7;&#x9700;&#x8981;&#x63D0;&#x524D;&#x5B89;&#x88C5;&#x76F8;&#x5173;&#x8F6F;&#x4EF6;&#x5305;&#xFF0C;&#x5982; rustc nightly&#xFF0C;qemu-4.1.0+&#xFF0C;device-tree-compiler &#x7B49;&#xFF08;&#x540E;&#x7EED;&#x7AE0;&#x8282;&#x4F1A;&#x63D0;&#x4F9B;&#x5B89;&#x88C5;&#x6559;&#x7A0B;&#xFF09;&#x3002;&#x5177;&#x4F53;&#x7EC6;&#x8282;&#x53EF;&#x53C2;&#x8003; <a href="https://github.com/rcore-os/rCore_tutorial/blob/master/Dockerfile" target="_blank">&#x652F;&#x6301; docker &#x5EFA;&#x7ACB;&#x7684; Dockerfile</a> &#x548C; <a href="https://github.com/rcore-os/rCore_tutorial/blob/master/.github/workflows/main.yml" target="_blank">&#x652F;&#x6301; github &#x81EA;&#x52A8;&#x6D4B;&#x8BD5;&#x7684; main.yml</a> &#x3002;&#x5047;&#x5B9A;&#x5B89;&#x88C5;&#x597D;&#x4E86;&#x76F8;&#x5173;&#x8F6F;&#x4EF6;&#xFF0C;&#x76F4;&#x63A5;&#x53EA;&#x9700;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x5373;&#x53EF;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x5728;&#x628A;&#x5B9E;&#x9A8C;&#x4EE3;&#x7801;&#x4E0B;&#x8F7D;&#x5230;&#x672C;&#x5730;</span>
<span class="token function">git</span> clone  https://github.com/rcore-os/rCore_tutorial.git
<span class="token comment"># &#x7F16;&#x8BD1;</span>
<span class="token builtin class-name">cd</span> rCore_tutorial<span class="token punctuation">;</span>  <span class="token function">git</span> checkout master<span class="token punctuation">;</span> <span class="token function">make</span> all
<span class="token comment"># &#x8FD0;&#x884C;</span>
<span class="token function">make</span> run
<span class="token comment"># &#x5982;&#x679C;&#x4E00;&#x5207;&#x6B63;&#x5E38;&#xFF0C;&#x5219;qemu&#x6A21;&#x62DF;&#x7684;risc-v64&#x8BA1;&#x7B97;&#x673A;&#x5C06;&#x8F93;&#x51FA;</span>

OpenSBI v0.4 <span class="token punctuation">(</span>Jul  <span class="token number">2</span> <span class="token number">2019</span> <span class="token number">11</span>:53:53<span class="token punctuation">)</span>
   ____                    _____ ____ _____
  / __ <span class="token punctuation">\</span>                  / ____<span class="token operator">|</span>  _ <span class="token punctuation">\</span>_   _<span class="token operator">|</span>
 <span class="token operator">|</span> <span class="token operator">|</span>  <span class="token operator">|</span> <span class="token operator">|</span>_ __   ___ _ __ <span class="token operator">|</span> <span class="token punctuation">(</span>___ <span class="token operator">|</span> <span class="token operator">|</span>_<span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token operator">|</span>
 <span class="token operator">|</span> <span class="token operator">|</span>  <span class="token operator">|</span> <span class="token operator">|</span> <span class="token string">&apos;_ \ / _ \ &apos;</span>_ <span class="token punctuation">\</span> <span class="token punctuation">\</span>___ <span class="token punctuation">\</span><span class="token operator">|</span>  _ <span class="token operator">&lt;</span> <span class="token operator">|</span> <span class="token operator">|</span>
 <span class="token operator">|</span> <span class="token operator">|</span>__<span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span>_<span class="token punctuation">)</span> <span class="token operator">|</span>  __/ <span class="token operator">|</span> <span class="token operator">|</span> <span class="token operator">|</span>____<span class="token punctuation">)</span> <span class="token operator">|</span> <span class="token operator">|</span>_<span class="token punctuation">)</span> <span class="token operator">||</span> <span class="token operator">|</span>_
  <span class="token punctuation">\</span>____/<span class="token operator">|</span> .__/ <span class="token punctuation">\</span>___<span class="token operator">|</span>_<span class="token operator">|</span> <span class="token operator">|</span>_<span class="token operator">|</span>_____/<span class="token operator">|</span>____/_____<span class="token operator">|</span>
        <span class="token operator">|</span> <span class="token operator">|</span>
        <span class="token operator">|</span>_<span class="token operator">|</span>

Platform Name          <span class="token builtin class-name">:</span> QEMU Virt Machine
Platform HART Features <span class="token builtin class-name">:</span> RV64ACDFIMSU
Platform Max HARTs     <span class="token builtin class-name">:</span> <span class="token number">8</span>
Current Hart           <span class="token builtin class-name">:</span> <span class="token number">0</span>
Firmware Base          <span class="token builtin class-name">:</span> 0x80000000
Firmware Size          <span class="token builtin class-name">:</span> <span class="token number">112</span> KB
Runtime SBI Version    <span class="token builtin class-name">:</span> <span class="token number">0.1</span>

PMP0: 0x0000000080000000-0x000000008001ffff <span class="token punctuation">(</span>A<span class="token punctuation">)</span>
PMP1: 0x0000000000000000-0xffffffffffffffff <span class="token punctuation">(</span>A,R,W,X<span class="token punctuation">)</span>
switch satp from 0x8000000000080255 to 0x800000000008100e
++++ setup memory<span class="token operator">!</span>    ++++
++++ setup interrupt<span class="token operator">!</span> ++++
available programs <span class="token keyword">in</span> rust/ are:
  <span class="token builtin class-name">.</span>
  <span class="token punctuation">..</span>
  user_shell
  notebook
  hello_world
  model
++++ setup fs<span class="token operator">!</span>        ++++
++++ setup process<span class="token operator">!</span>   ++++
++++ setup timer<span class="token operator">!</span>     ++++
Rust user shell
<span class="token operator">&gt;&gt;</span>
</code></pre>
<p><div id="page-footer" class="localized-footer"><hr><p><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css"></p>
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
  var gitalk = new Gitalk({
    clientID: "ab871063a9fa7f1da571",
    clientSecret: "4760b384e3e452d2241d859cfa6a7da21a8729ec",
    repo: "rCore_tutorial_doc",
    owner: "rcore-os",
    admin: [
      "chyyuu",
      "xyongcn",
      "wangrunji0408",
      "xy-plus",
      "PanQL",
      "wyfcyx",
      "equation314"
    ],
    id: location.pathname,
    distractionFreeMode: false
  });
  gitalk.render("gitalk-container");
</script>
</div></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../" class="navigation navigation-prev " aria-label="Previous page: Introduction">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../chapter1/introduction.html" class="navigation navigation-next " aria-label="Next page: 第一章：独立式可执行程序">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"第零章：实验环境说明","level":"1.2","depth":1,"next":{"title":"第一章：独立式可执行程序","level":"1.3","depth":1,"path":"chapter1/introduction.md","ref":"chapter1/introduction.md","articles":[{"title":"[安装 nightly rust]","level":"1.3.1","depth":2,"path":"chapter1/part1.md","ref":"chapter1/part1.md","articles":[]},{"title":"使用包管理器 cargo 创建 rust binary 项目","level":"1.3.2","depth":2,"path":"chapter1/part2.md","ref":"chapter1/part2.md","articles":[]},{"title":"移除标准库依赖","level":"1.3.3","depth":2,"path":"chapter1/part3.md","ref":"chapter1/part3.md","articles":[]},{"title":"[移除 runtime 依赖]","level":"1.3.4","depth":2,"path":"chapter1/part4.md","ref":"chapter1/part4.md","articles":[]},{"title":"总结与展望","level":"1.3.5","depth":2,"path":"chapter1/part5.md","ref":"chapter1/part5.md","articles":[]}]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["hide-element","chapter-fold","katex","alerts","emphasize","-highlight","prism","localized-footer","mermaid-gb3"],"pluginsConfig":{"chapter-fold":{},"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"emphasize":{},"search":{},"localized-footer":{"filename":"extensions/comment/gitalk.html","hline":"true"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"hide-element":{"elements":[".gitbook-link"]},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"alerts":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter0/introduction.md","mtime":"2020-09-09T11:31:56.891Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-09-10T06:57:01.716Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

